package com.breakfast.fun.data.entity.user.order;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yukai on 16/9/26.
 */

public class OrderDetail {

    /**
     * total : 0
     * pageTotal : 0
     * data : {"id":57028,"orderTime":"2016-09-21 18:15:36","orderNo":"F201609211815365407","totalPrice":9,"payPrice":9,"freePrice":0,"payFree":0,"quantity":1,"payType":"余额支付","refundState":0,"state":1,"payState":2,"consignee":"余凯","userMobile":"18359928629","detail":"仓山区-山亚创业园山亚创业园3楼车库咖啡三楼早范","sendTime":"08:00~08:15","remark":"","parentId":0,"isMuti":1,"activityName":"","shopName":"周套餐","isPackage":1,"goods":[{"id":33575,"orderId":57029,"orderNo":"F201609211815365407","productId":412,"productPrice":9,"productCount":1,"productName":"小笼包（8个）+三黑强肾豆浆","free":0,"shopId":28,"categoryId":218,"categoryName":"A44","productImage":"http://static.52letsgo.cn//product_image/2/11/44c2a75d-8_-1494321966.jpg","totalPrice":9,"shopName":"粗粮兄弟","sendDate":"2016-09-22"}]}
     * msg : 查询成功
     * success : true
     */

    private int total;
    private int pageTotal;
    /**
     * id : 57028
     * orderTime : 2016-09-21 18:15:36
     * orderNo : F201609211815365407
     * totalPrice : 9.0
     * payPrice : 9.0
     * freePrice : 0.0
     * payFree : 0.0
     * quantity : 1
     * payType : 余额支付
     * refundState : 0
     * state : 1
     * payState : 2
     * consignee : 余凯
     * userMobile : 18359928629
     * detail : 仓山区-山亚创业园山亚创业园3楼车库咖啡三楼早范
     * sendTime : 08:00~08:15
     * remark :
     * parentId : 0
     * isMuti : 1
     * activityName :
     * shopName : 周套餐
     * isPackage : 1
     * goods : [{"id":33575,"orderId":57029,"orderNo":"F201609211815365407","productId":412,"productPrice":9,"productCount":1,"productName":"小笼包（8个）+三黑强肾豆浆","free":0,"shopId":28,"categoryId":218,"categoryName":"A44","productImage":"http://static.52letsgo.cn//product_image/2/11/44c2a75d-8_-1494321966.jpg","totalPrice":9,"shopName":"粗粮兄弟","sendDate":"2016-09-22"}]
     */

    private OrderDetailData data;
    private String msg;
    private boolean success;

    public static OrderDetail objectFromData(String str) {

        return new Gson().fromJson(str, OrderDetail.class);
    }

    public static List<OrderDetail> arrayOrderDetailFromData(String str) {

        Type listType = new TypeToken<ArrayList<OrderDetail>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

    public OrderDetailData getData() {
        return data;
    }

    public void setData(OrderDetailData data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

}
